Wrapper initialization javascript

Description

JavaScript executed when the ViewBox wrapper is initialized.

Discussion

Optional JavaScript that can be executed when the ViewBox wrapper is initialized. The JavaScript is executed after the Wrapper HTML has been rendered but before the ViewBox itself is populated with data and rendered.

Your JavaScript has access to the this variable, which is a pointer to the ViewBox being rendered. Your JavaScript can modify the ViewBox properties. For example, you could change what layout to render in a ViewBox that has multiple layouts:

// Render using ViewBox layout "layout2" instead of the default:
this.layout = "layout2";

Because the ViewBox Wrapper HTML has already been rendered at this point, changing the ViewBow Wrapper HTML property will have no effect until the ViewBox is re-rendered. This is because the Wrapper HTML has already been rendered on the page.

However, because the Wrapper HTML has been rendered, you can inject content into it using JavaScript. For example, the Wrapper HTML definition below contains a footer with the id "vbFooter":

<div a5-layout-target="true"></div>
<div class="footer" id="vbFooter"></div>

The Wrapper initialization javascript can be used to insert content into the footer as follows:

A5.u.element.setContent("vbFooter","This is my footer");

To insert information, such as summary values calculated from the ViewBox data, you will need to use a different client-side event as the ViewBox data is not available when Wrapper initialization javascript is executed. Wrapper initialization javascript is executed before the onPopulate event.

See Also